{
Function:			_YYYYMMDD.ToELDate

Description:		Translates a YYYYMMDD date to EasyLanguage format (YYYMMDD) and validates the result.

					Similar to function ELDate_Consol, but also includes validataion of result.

					A valid date will be less than 10 years ago (since 10 years of data is available for charts )
					and will not exceed the CurrentDate.

					No action is taken if inpute date (YYYYMMDD) is zero.

Author:				MarkSanDiego

Updated:			04/09/10	original version

Usage:
_______________________________________________________________________________________

inputs:
	DateYYYYMMDD(20100320);

vars:
	oDate(0);


	value1 = _YYYYMMDD.ToELDate(DateYYYYMMDD, "DateYYYYMMDD");

_______________________________________________________________________________________
}

inputs:
	YYYYMMDD(NumericSimple),
	ParamName(StringSimple);

vars:
	oDate(0);


	{ validate YYYYMMDD }
	if YYYYMMDD <> 0 then begin
		oDate = YYYYMMDD - 19000000;
		if oDate < CurrentDate - 100000 then begin			{ 10 years = 100000 }
			RaiseRunTimeError("Function _YYYYMMDD.ToDate:  " & ParamName & " is more than 10 years ago");
		end else if oDate > CurrentDate then begin
			RaiseRunTimeError("Function _YYYYMMDD.ToDate:  " & ParamName & " may not exceed the CurrentDate");
		end;
	end;

	_YYYYMMDD.ToELDate = oDate;
